package siediyu.tutorialmod.item;

import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroupBuilderImpl;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import siediyu.tutorialmod.Tutorial;
import siediyu.tutorialmod.block.ModBlocks;

public class ModItemGroups {

    // 石榴石组
    // 这里将两个石榴石item添加到组内
    public static final ItemGroup PINK_GARNET_ITEMS_GROUP = Registry.register(Registries.ITEM_GROUP,
            Identifier.of(Tutorial.MOD_ID, "pink_garnet_items"),
            FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.PINK_GARNET))//定义图标
                    .displayName(Text.translatable("itemgroup.tutorial.pink_garnet_items"))
                    .entries((displayContext, entries) -> {
                        //将物品添加到物品组
                        entries.add(ModItems.PINK_GARNET);
                        entries.add(ModItems.RAW_PINK_GARNET);
                    })
                    .build());

    // 石榴石块组
    // 这里将两个石榴石block添加到组内
    public static final ItemGroup PINK_GARNET_BLOCKS_GROUP = Registry.register(Registries.ITEM_GROUP,
            Identifier.of(Tutorial.MOD_ID, "pink_garnet_blocks"),
            FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.PINK_GARNET_BLOCK))//定义图标
                    .displayName(Text.translatable("itemgroup.tutorial.pink_garnet_blocks"))
                    .entries((displayContext, entries) -> {
                        //将物品添加到物品组
                        entries.add(ModBlocks.PINK_GARNET_BLOCK);
                        entries.add(ModBlocks.RAW_PINK_GARNET_BLOCK);
                    })
                    .build());

    public static void registerItemGroups() {
        Tutorial.LOGGER.info("Registering Mod ItemGroups for " + Tutorial.MOD_ID);
    }
}
